package pojo;

import java.util.Comparator;

/**
 * 功能描述: 教师类,单链表数据节点
 * 2024/05/22
 * <p>
 * ZhangYi
 */
public class Teacher implements Comparator {

    private int id;
    private String tname;

    public Teacher next;

    public Teacher(int id,
                   String tname) {
        this.id = id;
        this.tname = tname;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTname() {
        return tname;
    }

    public void setTname(String tname) {
        this.tname = tname;
    }

    @Override
    public int compare(Object o1,
                       Object o2) {
        if (o1 instanceof Teacher && o2 instanceof Teacher) {
            Teacher t1 = (Teacher) o1;
            Teacher t2 = (Teacher) o2;
            return t1.id - t2.id;
        }
        return 0;
    }
}
